﻿using DotNetty.Buffers;
using DotNetty.Codecs;
using DotNetty.Transport.Channels;
using System;
using System.Collections.Generic;
using System.Text;

namespace EmbededChannelTest
{
    public class AbsIntEncoder : MessageToMessageEncoder<IByteBuffer>
    {
        protected override void Encode(IChannelHandlerContext context, IByteBuffer message, List<object> output)
        {
            while (message.ReadableBytes >= 4)
            {
                int value = message.ReadInt();
                output.Add(Math.Abs(value));
            }
        }
    }
}
